﻿package 
{
	import flash.display.DisplayObject;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.Event;
	import flash.net.URLRequest;
	
	/* Класс - звёздочка */
	public class ClStar extends ClObject
	{
		/* Используем для ускорения всех звёзд */
	    public static var GlobalSpeed:Number = 1.5;
		
		public function ClStar(mainRef:Main)
		{
			super(mainRef.stage);
			//this.stageRef = stageRef;
			//this.speed=Math.round((Math.random()*15)+1);
			//this.addEventListener(Event.ENTER_FRAME, update, false, 0, true);
			
			if (Main.useEmbededContent)
				LoadEmbededImage(Assets.StarImage);
			else
				LoadImage("../content/images/img_star_little.png");
		}
		
		
		override protected function update(e:Event):void
		{
			//if (speedPower==0)	return;
			
			y+=speedPower*GlobalSpeed;
			if (y>stageRef.stageHeight+20)
			{
				y=-20;
				x=Math.round((Math.random()*stageRef.stageWidth));
				//speed=Math.round((Math.random()*15)+7);
			}
		}
	}
}